load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_library(
    name = "common",
    hdrs = glob(["common/*.hpp"]),
    includes = ["common"],
    deps = [
        "@boost.log",
        "@boost.move",
        "@boost.mpl",
    ],
)

[cc_test(
    name = "test_" + test,
    timeout = "short",
    srcs = [test],
    local_defines = select({
        "@platforms//os:macos": ["BOOST_LOG_WITHOUT_IPC"],  # TODO: ld: symbol(s) not found for architecture
        "@platforms//os:windows": ["BOOST_LOG_WITHOUT_EVENT_LOG"],  # TODO: compile simple_event_log.mc
        "//conditions:default": [],
    }),
    deps = [
        ":common",
        "@boost.log",
        "@boost.test",
        "@boost.test//:unit_test_main",
        "@boost.thread",
    ],
) for test in glob(
    ["run/*.*pp"],
    exclude = [
        "run/filt_matches_spirit_classic.cpp",
        "run/filt_matches_spirit_qi.cpp",
        "run/filt_matches_xpressive.cpp",
    ],
)]

[cc_test(
    name = "test_" + test,
    timeout = "short",
    srcs = [test],
    deps = [
        "@boost.assert",
        "@boost.log",
        "@boost.type_traits",
    ],
) for test in glob(
    ["compile/*.*pp"],
    exclude = ["compile/self_contained_header.cpp"],
)]
